package or;

import java.util.PriorityQueue;

public class T0179 {
    public String largestNumber(int[] nums) {
        PriorityQueue<String> priorityQueue = new PriorityQueue<>((a, b) -> (b + a).compareTo(a + b));
        for (int e : nums) {
            priorityQueue.offer(String.valueOf(e));
        }
        StringBuilder s = new StringBuilder();
        while (!priorityQueue.isEmpty()) {
            s.append(priorityQueue.poll());
        }
        return s.charAt(0) == '0' ? "0" : s.toString();
    }
}
